package com.bwie.controller;
import com.bwie.Main;
import com.bwie.pojo.User;
import com.bwie.service.Impl.UserServiceImpl;
import com.bwie.service.UserService;
import com.bwie.utils.R;
import com.bwie.vo.LoginFromVo;
import com.bwie.vo.RegFromVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
* 用户表(tb_user)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/auth/user")
@Slf4j
public class UserController {
/**
* 服务对象
*/
    @Autowired
    private UserService userService;

    /**
     * 发送手机验证码
     * @param userMobile
     * @return
     */
    @PostMapping(value = "/sendPhoneCode/{userMobile}")
    public R sendPhoneCode(
            @PathVariable("userMobile") String userMobile
    ){
        return userService.sendPhoneCode(userMobile);
    }

    /**
     * 登录
     * @param loginFromVo
     * @return
     */
    @PostMapping(value = "/login")
    public R login(
            @RequestBody LoginFromVo loginFromVo
            ){
        return userService.login(loginFromVo);
    }

    /**
     * 用户注册
     * @param regFromVo
     * @return
     */
    @PostMapping(value = "/getReg")
    public R getReg(
        @RequestBody RegFromVo regFromVo
    ){
        return userService.getReg(regFromVo);
    }

    /**
     *用户菜单
     * @return
     */
    @PostMapping(value = "getTreeList")
    public R getTreeList(){
        return userService.getTreeList();
    }
}
